﻿using NUnit.Framework;

namespace DictionaryExt.Test {

    [TestFixture]
    public class SplitInTokenWith1Entry {

        [Test]
        public void With1Entry() {
            const string s = "a=1;";
            string[] result = StringExt.StringExt.SplitInToken(s);
            Assert.AreEqual("a=1", result[0]);
        }

        [Test]
        public void MissingSepAtEnd() {
            const string s = "a=1";
            string[] result = StringExt.StringExt.SplitInToken(s);
            Assert.AreEqual("a=1", result[0]);
        }

        [Test]
        public void Ending2Sep() {
            const string s = "a=1;;";
            string[] result = StringExt.StringExt.SplitInToken(s);
            Assert.AreEqual("a=1", result[0]);
            Assert.AreEqual(1, result.Length);
        }

        [Test]
        public void Leading2Sep() {
            const string s = ";;a=1;";
            string[] result = StringExt.StringExt.SplitInToken(s);
            Assert.AreEqual("a=1", result[0]);
            Assert.AreEqual(1, result.Length);
        }

        [Test]
        public void Leading2SepAndMissingSepAtEnd() {
            const string s = ";;a=1";
            string[] result = StringExt.StringExt.SplitInToken(s);
            Assert.AreEqual("a=1", result[0]);
            Assert.AreEqual(1, result.Length);
        }

    }
}
